<?php

class UltimosPartidosController extends Controller{
	
public function actionLastMatch(){
	$model=new LastMatchForm;
	$dao=Dao::Instance();
	$model->listTeam1 = CHtml::listData($dao->getTeamList(),'id_equipo','nombre');
	$model->listLocal = array('1'=>'Local','2'=>'Visitante','3'=>'Neutral','4'=>'Todas');
	if(isset($_GET['LastMatchForm'])){
		$model->attributes=$_GET['LastMatchForm'];
		if($model->validate()){
			$model->valid=true;
			$model->sintesis = $dao->getSintesisUltimoPartidos($model->team1,$model->local,$model->totalMatch);
		}
	}
	$params =array(
			'model'=>$model,
	);

	if(!isset($_GET["ajax"])) {$this->render('lastMatch', $params);}
	else { $model->valid=true;$this->renderPartial('lastMatch', $params);}
}
}